package Merlion.FRM.entity;

import Merlion.CRM.entity.SalesOrderEntity;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;

@Entity
public class InvoiceAndReceiptEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long invoiceId;
    private Long salesOrderId;
    private Double cashInAdvance; //always full amount
    private Double discountRate;
    private Double totalPrice;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date issueDate;
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date invoiceDueDate;
    private int creditTerm; //in days
    private int discountedCreditTerm; //in days
    private Double amountDue;
    private boolean invoiceStatus; //"not paid-0", "paid-1"
    private String deleteFlag;
    private String paymentMethod;
    
    @ManyToOne(cascade = {CascadeType.ALL})
    private SalesOrderEntity salesOrder;
    
    @OneToMany(cascade = {CascadeType.ALL})
    private Collection<InvoiceLineEntryEntity> iLineEntry;
    
    @OneToOne(cascade = {CascadeType.ALL})
    private CustomerJournalEntity journal;

    public InvoiceAndReceiptEntity() {
    }

    public Double getAmountDue() {
        return amountDue;
    }

    public void setAmountDue(Double amountDue) {
        this.amountDue = amountDue;
    }

    public Double getCashInAdvance() {
        return cashInAdvance;
    }

    public void setCashInAdvance(Double cashInAdvance) {
        this.cashInAdvance = cashInAdvance;
    }

    public int getCreditTerm() {
        return creditTerm;
    }

    public void setCreditTerm(int creditTerm) {
        this.creditTerm = creditTerm;
    }

    public String getDeleteFlag() {
        return deleteFlag;
    }

    public void setDeleteFlag(String deleteFlag) {
        this.deleteFlag = deleteFlag;
    }

    public Double getDiscountRate() {
        return discountRate;
    }

    public void setDiscountRate(Double discountRate) {
        this.discountRate = discountRate;
    }

    public int getDiscountedCreditTerm() {
        return discountedCreditTerm;
    }

    public void setDiscountedCreditTerm(int discountedCreditTerm) {
        this.discountedCreditTerm = discountedCreditTerm;
    }

    public Date getInvoiceDueDate() {
        return invoiceDueDate;
    }

    public void setInvoiceDueDate(Date invoiceDueDate) {
        this.invoiceDueDate = invoiceDueDate;
    }

    public Long getInvoiceId() {
        return invoiceId;
    }

    public void setInvoiceId(Long invoiceId) {
        this.invoiceId = invoiceId;
    }

    public boolean isInvoiceStatus() {
        return invoiceStatus;
    }

    public void setInvoiceStatus(boolean invoiceStatus) {
        this.invoiceStatus = invoiceStatus;
    }

    public Date getIssueDate() {
        return issueDate;
    }

    public void setIssueDate(Date issueDate) {
        this.issueDate = issueDate;
    }

    public SalesOrderEntity getSalesOrder() {
        return salesOrder;
    }

    public void setSalesOrder(SalesOrderEntity salesOrder) {
        this.salesOrder = salesOrder;
    }

    public Long getSalesOrderId() {
        return salesOrderId;
    }

    public void setSalesOrderId(Long salesOrderId) {
        this.salesOrderId = salesOrderId;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Collection<InvoiceLineEntryEntity> getiLineEntry() {
        return iLineEntry;
    }

    public void setiLineEntry(Collection<InvoiceLineEntryEntity> iLineEntry) {
        this.iLineEntry = iLineEntry;
    }

    public CustomerJournalEntity getJournal() {
        return journal;
    }

    public void setJournal(CustomerJournalEntity journal) {
        this.journal = journal;
    }

    public String getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(String paymentMethod) {
        this.paymentMethod = paymentMethod;
    }
    
}
